#include <iostream>
#include <opencv/highgui.h>
#include <opencv2/highgui/highgui.hpp>
#include <ctime>
#include <cstdlib>
using namespace std;

int main()
{int a,b;
    IplImage* img=cvLoadImage("c:\\image.jpg",CV_LOAD_IMAGE_UNCHANGED);
CvScalar pixel;
srand(time(NULL));
    for(int i=0;i<200;i++){
       a=rand()%240;
       b=rand()%235;


           pixel=cvGet2D(img,a,b);
           pixel.val[0]=255;
           pixel.val[1]=255;
           pixel.val[2]=255;

           cvSet2D(img,a,b,pixel);
            a=rand()%240;
       b=rand()%235;


           pixel=cvGet2D(img,a,b);
           pixel.val[0]=0;
           pixel.val[1]=0;
           pixel.val[2]=0;

           cvSet2D(img,a,b,pixel);
        }

    cvNamedWindow("frame");

    cvShowImage("frame",img);

    cvWaitKey(0);

    return 0;
}
